<?php
/**
 * [PHPFOX_HEADER]
 */

defined('PHPFOX') or exit('NO DICE!');

/**
 * 
 * 
 * @copyright		[PHPFOX_COPYRIGHT]
 * @author  		Raymond Benc
 * @package 		Phpfox_Component
 * @version 		$Id: view.class.php 3444 2011-11-03 12:56:50Z Raymond_Benc $
 */
class Marketplace_Component_Controller_Setting extends Phpfox_Component
{
	/**
	 * Class process method wnich is used to execute this component.
	 */
	public function process()
	{
            Phpfox::isUser(true);
            $iStoreId = $this->request()->get("id",false);
            $aStores = Phpfox::getService('marketplace.store')->getByUser(Phpfox::getUserId());
            if(empty($aStores)){
                return false;
            }
            if($iStoreId == false){
                $aDefaultStore = Phpfox::getService('marketplace.store')->getForEdit($aStores[0]['store_id']);
            }
            else{
                $aDefaultStore = Phpfox::getService('marketplace.store')->getForEdit($iStoreId);
            }
            		
            $this->template()->setHeader('cache', array(
                                        'view.css' => 'module_marketplace',
				)
			)
                ->assign(array(
                'aForms' => $aDefaultStore,
                'aStores' => $aStores,
                'iReturnStoreSetting' => 1
            ));
	}
	
	/**
	 * Garbage collector. Is executed after this class has completed
	 * its job and the template has also been displayed.
	 */
	public function clean()
	{
	}
}

?>